package com.caigou.service.impl;

import com.caigou.bean.cms.entity.ArticleCase;
import com.caigou.mapper.cms.ArticleCaseMapper;
import com.caigou.pojo.ArticleCaseData;
import com.caigou.service.ArticleCaseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ArticleCaseServiceImpl implements ArticleCaseService {

    @Resource
    private ArticleCaseMapper articleCaseMapper;

    @Override
    public ArticleCase saveArticleCaseData(String articleId, String caseTitle, String caseContent) {
        ArticleCase articleCase = new ArticleCase();
        articleCase.setArticleId(articleId);
        articleCase.setCaseTitle(caseTitle);
        articleCase.setCaseContent(caseContent);
        articleCaseMapper.saveArticleCaseData(articleCase);
        return articleCase;
    }

    @Override
    public List<ArticleCaseData> loadArticleCaseData(String articleId) {
        return articleCaseMapper.loadArticleCaseData(articleId);
    }

    @Override
    public void deleteArticleCaseAllData(String articleId) {
        articleCaseMapper.deleteArticleCaseAllData(articleId);
    }
}
